package de.gameduell.framework.game.billard.model {
	import de.gameduell.framework.debug.Debug;
	import de.gameduell.framework.game.Player;
	import de.gameduell.framework.game.watch.StopWatch;	

	/**
	 * @author cbra
	 */
	public class BillardPlayer extends Player {
		private var _pocketedBalls:Array = new Array();
		private var _watch:StopWatch = new StopWatch();
		
		public function BillardPlayer(name:String, aAvatar:String, rank:String = NO_RANK) {
			super(name, aAvatar, rank);
			// this watch is just to track the total play time of each round and will never timeout
			_watch.endTime = 30*60*1000; 
		}
		
		override public function set active( state:Boolean ):void{		
			super.active = state;
			if(state){
				if(_watch.isPaused){
					_watch.unPause();
				}else{				
					_watch.start();
				}
			}else{
				_watch.pause();
			}
		}
		
		public function resetWatch():void{
			_watch = new StopWatch();
			_watch.endTime = 30*60*1000; 
		}
		
		public function get watch():StopWatch{
			return _watch;
		}
		
		public function set pocketedBalls(aBalls:Array):void{
			_pocketedBalls = aBalls;
			Debug.trace("BillardPlayer::pocketedBalls "+_pocketedBalls);
		}
		
		public function get pocketedBalls():Array{
			return _pocketedBalls;
		}
	}
}
